package com.zzk.www.tool.common;

import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;

/**
 * Created by zzk on 2017/12/21.
 */
public class MD5Util {


    public static String MD5Encode(String key) {
        if(StringUtils.isBlank(key)) {
            key = "";
        }

        return DigestUtils.md5Hex(key).toUpperCase();
    }


    public static String MD5EncodeForPwd(String key, String salt) {
        if(StringUtils.isBlank(key)) {
            key = "";
        }

        if(StringUtils.isBlank(salt)) {
            salt = "";
        }

        return DigestUtils.md5Hex(key + "_" + salt).toUpperCase();
    }



}
